import { defineStore } from "pinia";
import type { Context } from "../types";
import { computed, ref } from "vue";

export const useContextStore = defineStore("context", () => {

  const currentContext = ref<Context>([])

  const setCurrentContext = (context: Context) => {
    currentContext.value = context
  }

  const clearCurrentContext = () => {
    currentContext.value = []
  }

  const appendCurrentContext = (context: Context) => {
    currentContext.value = [...currentContext.value, ...context]
  }

  return {
    currentContext,
    setCurrentContext,
    clearCurrentContext,
    appendCurrentContext
  }
})
